<script type="text/javascript">
    //全局变量
    var GV = {
        ROOT: "__ROOT__/",
        WEB_ROOT: "__WEB_ROOT__/",
        JS_ROOT: "public/js/"
    };
</script>
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/wind.js"></script>
<script src="__TMPL__Public/assets/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/js/frontend.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/move-top.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/easing.js"></script>
<script src="__TMPL__Public/assets/js/responsiveslides.min.js"></script>
<script src="__TMPL__Public/assets/js/jquery.swipebox.min.js"></script>
<script type="text/javascript" src="__TMPL__Public/assets/js/jquery.mixitup.min.js"></script>

<!---- start-smoth-scrolling---->

<script type="text/javascript">
    jQuery(document).ready(function($) {
        $(".scroll").click(function(event){
            event.preventDefault();
            $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
        });
    });
</script>

<!--start-smoth-scrolling-->

<!-- script-for-menu -->
<script>
    $("span.menu").click(function(){
        $(" ul.navig").slideToggle("slow" , function(){
        });
    });
</script>
<!-- script-for-menu -->

<script>
    $(function(){
        $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });

        $("#main-menu li.dropdown").hover(function(){
            $(this).addClass("open");
        },function(){
            $(this).removeClass("open");
        });

        $.post("{:U('user/index/is_login')}",{},function(data){
            if(data.status==1){
                if(data.user.avatar){
                    $("#main-menu-user .headicon").attr("src",data.user.avatar.indexOf("http")==0?data.user.avatar:"{:sp_get_image_url('[AVATAR]','!avatar')}".replace('[AVATAR]',data.user.avatar));
                }

                $("#main-menu-user .user-nicename").text(data.user.user_nicename!=""?data.user.user_nicename:data.user.user_login);
                $("#main-menu-user li.login").show();

            }
            if(data.status==0){
                $("#main-menu-user li.offline").show();
            }

            /* $.post("{:U('user/notification/getLastNotifications')}",{},function(data){
                $(".nav .notifactions .count").text(data.list.length);
            }); */

        });
        ;(function($){
            $.fn.totop=function(opt){
                var scrolling=false;
                return this.each(function(){
                    var $this=$(this);
                    $(window).scroll(function(){
                        if(!scrolling){
                            var sd=$(window).scrollTop();
                            if(sd>100){
                                $this.fadeIn();
                            }else{
                                $this.fadeOut();
                            }
                        }
                    });

                    $this.click(function(){
                        scrolling=true;
                        $('html, body').animate({
                            scrollTop : 0
                        }, 500,function(){
                            scrolling=false;
                            $this.fadeOut();
                        });
                    });
                });
            };
        })(jQuery);

        $("#backtotop").totop();


    });
</script>
